﻿<UserControl x:Class="CBR.Views.InfoView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:Converters="clr-namespace:CBR.Components.Converters"
        xmlns:Controls="clr-namespace:CBR.Components.Controls"
        xmlns:Models="clr-namespace:CBR.Core.Models;assembly=CBR.Core" 
	    mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="800" 
			 Background="{DynamicResource CbrDarkBackgroundBrush}">
    
    <UserControl.Resources>
        
        <DataTemplate x:Key="PropertyTemplate">
            <UniformGrid Margin="4" Columns="2">
                <Label Content="{Binding Key}" />
                <TextBox Text="{Binding Value}" />
            </UniformGrid>
        </DataTemplate>

    </UserControl.Resources>

	<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Style="{DynamicResource CbrScrollViewer}"
				   Visibility="{Binding IsEmpty, Converter={x:Static Converters:InversedBoolToVisibilityConverter.Instance}}">

		<Grid Margin="15">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="*" />
			</Grid.RowDefinitions>

			<StackPanel>
				<StackPanel Orientation="Horizontal">
					<TextBlock Style="{DynamicResource CbrTitleLabel}" Margin="5"
							   Text="{LocalizationExtension ResModul=CBR.Backstage, Key=InfoView.Title, DefaultValue=Information about }" />
					<TextBlock Style="{DynamicResource CbrTitleLabel}" Margin="5" Text="{Binding Path=FileName}" />
				</StackPanel>
				<TextBlock Style="{DynamicResource CbrTextBlockSmall}" Margin="5" Text="{Binding Path=Folder}"/>
				<Line Style="{DynamicResource CbrDashedSeparator}" X1="0" X2="1" Grid.Row="1" Grid.ColumnSpan="3" VerticalAlignment="Top" />
			</StackPanel>

			<Grid Grid.Row="1">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="139*" />
					<ColumnDefinition Width="14*" />
					<ColumnDefinition Width="125*" />
				</Grid.ColumnDefinitions>

				<StackPanel Grid.Column="0" Orientation="Vertical" Margin="10">
					<TextBlock Style="{DynamicResource CbrSubTitleLabel}" Margin="5"
							  Text="{LocalizationExtension ResModul=CBR.Backstage, Key=InfoView.Cover, DefaultValue=Cover}" />
					<Image Source="{Binding Cover}" Width="70"></Image>

					<Line Style="{DynamicResource CbrDashedSeparator}" X1="0" X2="1" />

					<TextBlock Style="{DynamicResource CbrSubTitleLabel}" Margin="5"
							   Text="{LocalizationExtension ResModul=CBR.Backstage, Key=InfoView.Properties, DefaultValue=Properties}" />
					<StackPanel>
						<UniformGrid Columns="2">

							<Label Style="{DynamicResource CbrLabel}" Content="{LocalizationExtension ResModul=CBR.Backstage, Key=InfoView.Type, DefaultValue=Type}" />
							<Image Width="32" Height="32" VerticalAlignment="Center" HorizontalAlignment="Left"
									Source="{Binding Path=Type, Converter={x:Static Converters:TypeToImageConverter.Instance}}" />

							<Label Style="{DynamicResource CbrLabel}" Content="{LocalizationExtension ResModul=CBR.Backstage, Key=InfoView.Size, DefaultValue=Size}" />
							<Label Style="{DynamicResource CbrLabelValue}" Content="{Binding Path=Size, Converter={x:Static Converters:LongToFileSizeConverter.Instance}}"/>

							<Label Style="{DynamicResource CbrLabel}" Content="{LocalizationExtension ResModul=CBR.Backstage, Key=InfoView.PageCount, DefaultValue=Page count}" />
							<Label Style="{DynamicResource CbrLabelValue}" Content="{Binding PageCount}"/>

							<Label Style="{DynamicResource CbrLabel}" Content="{LocalizationExtension ResModul=CBR.Backstage, Key=InfoView.Rating, DefaultValue=Rating}" />
							<Controls:RatingControl HorizontalAlignment="Stretch" Height="15" RatingValue="{Binding Rating}" />

							<Label Style="{DynamicResource CbrLabel}" Content="{LocalizationExtension ResModul=CBR.Backstage, Key=InfoView.HasBeenRead, DefaultValue=Has been read}" />
							<Label Style="{DynamicResource CbrLabelValue}" Content="{Binding IsRead}"/>

							<Label Style="{DynamicResource CbrLabel}" Content="{LocalizationExtension ResModul=CBR.Backstage, Key=InfoView.IsSecured, DefaultValue=Is secured}" />
							<Label Style="{DynamicResource CbrLabelValue}" Content="{Binding IsSecured}"/>

						</UniformGrid>
                
					</StackPanel>
					<Line Style="{DynamicResource CbrDashedSeparator}" X1="0" X2="1" />
				</StackPanel>

				<Line Grid.Column="1" X1="0" Y2="1" Style="{DynamicResource CbrVerticalSeparator}" />

				<StackPanel Grid.Column="2" Orientation="Vertical" Margin="10">
            
					<TextBlock Style="{DynamicResource CbrSubTitleLabel}" Margin="5"
							  Text="{LocalizationExtension ResModul=CBR.Backstage, Key=InfoView.DynProperties, DefaultValue=Dynamic properties}" />
					<Label Style="{DynamicResource CbrLabel}" Margin="5" HorizontalAlignment="Stretch"
						   Content="{LocalizationExtension ResModul=CBR.Backstage, Key=InfoView.DynHelp, DefaultValue=Comming from the option panel_you can define these values here}" />

					<ListBox Style="{DynamicResource CbrStandardListBox}" ItemsSource="{Binding KeyValueList}" ItemTemplate="{StaticResource PropertyTemplate}" />
            
					<Line Style="{DynamicResource CbrDashedSeparator}" X1="0" X2="1" />
				</StackPanel>
		</Grid>
		</Grid>

	</ScrollViewer>
	
</UserControl>
